<%@page contentType="text/html;charset=UTF-8"%>
<%@page pageEncoding="UTF-8"%>
<%@ page session="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<c:if test="${UIModel.getNumberOfRows() > 0}">
	<table class="tablesorter" cellspacing="0">
		<thead>
			<tr>
				<th></th>
				<c:forEach items="${UIModel.getFieldLabels()}" var="item"
					varStatus="status">
					<th>${UIModel.getFieldLabels()[status.index]}</th>
				</c:forEach>
				<th></th>
				<th></th>
			</tr>
		</thead>
		<tbody>
			<c:forEach begin="0" end="${UIModel.getNumberOfRows()-1}"
				varStatus="row">
				<tr>
					<td><input type="checkbox"></td>
					<c:forEach begin="0" end="${UIModel.getNumberOfColumns()-1}"
						varStatus="column">
						<td onclick="alert('Hi there')">${UIModel.getValueAt(row.index, column.index)}</td>
					</c:forEach>
					<td>
						<form action="edit" method="get">
							<input type="image" src="../resources/admin/images/icn_edit.png"
								title="Edit"> <input type="hidden" name="id"
								value="${UIModel.getId(row.index)}" />
						</form>
					</td>
					<td>
						<form action="delete" method="get">
							<input type="image" src="../resources/admin/images/icn_trash.png"
								title="Trash"> <input type="hidden" name="id"
								value="${UIModel.getId(row.index)}" />
						</form>
					</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
</c:if>